//
//  MYXMyFriendModel.m
//  meiyinxiang
//
//  Created by 陈李飞 on 2017/11/15.
//  Copyright © 2017年 hbjApple. All rights reserved.
//

#import "MYXMyFriendModel.h"

@implementation MYXMyFriendModel
- (instancetype)init{
    self = [super init];
    if (self) {
        if (self.note_name) {
            self.friend_nickName = self.note_name;
        }
    }
    return self;
}

//自定义排序方法
- (NSComparisonResult)compareFriend:(MYXMyFriendModel *)friend {
    //默认按时间排序
    NSComparisonResult result = [friend.apply_time compare:self.apply_time];//注意:基本数据类型要进行数据转换
    return result;
}

- (NSArray *)searchMessagesWithArrays:(NSArray *)arrays withStr:(NSString *)searchStr {
    NSArray *array;
    NSPredicate *predicate = [NSPredicate predicateWithFormat:@"friend_nickName contains [cd] %@",searchStr];
    array                  = [arrays filteredArrayUsingPredicate:predicate];
    return array;
}

//搜索通讯录中
- (NSArray *)searchTelUsersWithArrays:(NSArray *)arrays withStr:(NSString *)searchStr {
    NSArray *array;
    NSPredicate *predicate = [NSPredicate predicateWithFormat:@"friend_tel contains [cd] %@",searchStr];
    array                  = [arrays filteredArrayUsingPredicate:predicate];
    return array;
}
@end
